Skip to content

Refuse unknown collector arguments, roll up days a stopped run landed, and keep tests off the repository .env (#61) - #62

Merged
thebenignhacker merged 2 commits into
mainfrom
integrate/2026-10-07-r7
Oct 7, 2026
Merged

thebenignhacker merged 2 commits into
mainfrom
integrate/2026-10-07-r7

Conversation

@thebenignhacker

Copy link
Copy Markdown
Contributor

This pull request carries two commits for the PyPI country collector, its tests and the README. The first closes the seven follow-up items in #61. The second narrows the README sentence about which arguments the collector refuses.

The collector refuses any argument it receives other than --dry-run (with npm, the arguments after the -- separator) with a usage message and exit code 2, and reads npm_config_dry_run=true (what npm sets for npm run collect:pypi-countries --dry-run without the --) as a dry run. A flag given without the -- goes to npm and is not among the collector's arguments, so a mistyped npm run collect:pypi-countries --dryrun is not refused and runs a normal collection; the README says so. A run that stops on a monthly cap, a byte-ceiling refusal or an error after landing at least one day still rewrites the 30-day rollup. The store's month-to-date total throws when a day of the current month holds a billed-bytes figure that is negative or not an integer. When every candidate day is already fetched, the dry run logs that the next run would bill nothing and words its verdict as a prediction for a new day of the sample's size. The two test files that spawn the PyPI country collector set cwd to their temporary directory, so the process reads a .env there and not the one at the repository root. The README drops the step that asked workflow users to set Google Cloud credentials, since the scheduled workflow does not run the country collector.

Included

  • Refuse unknown collector arguments, roll up days a stopped run landed, and keep tests off the repository .env (Follow-up fixes after #60 (7 items) #61)
  • Say in the README that a mistyped flag without -- runs a normal PyPI country collection

Verified on this exact tree

Node 24.21.0 (.node-version pins 24). The installed dependencies were checked against package-lock.json: 205 packages, 0 version mismatches, 30 optional packages not installed.

  • Build: npm run build (Next.js 16.2.7) exit 0, 3 static pages generated, 12 dynamic API routes listed.
  • Typecheck: not applicable, the repository is plain JavaScript with no tsconfig.json and no typecheck script.
  • Lint: not applicable, no lint script or ESLint configuration in the repository.
  • Changelog check: not applicable, the repository has no changelog file or changelog script.
  • Tests: node --test --test-concurrency=4 test/*.test.js over 17 test files: 221 tests, 221 passed, 0 failed, 0 cancelled, 0 skipped, 0 todo.
  • Invocation forms, run without BigQuery credentials: npm run collect:pypi-countries -- --dryrun, npm run collect:pypi-countries -- foo and npm run collect:pypi-countries -- --dry-run --foo exit 2 with the usage message. npm run collect:pypi-countries --dry-run is a dry run and writes no run status. npm run collect:pypi-countries --dryrun writes the run status skipped_no_credentials, which is the normal collection path.

No pre-existing or load-related failures: the run had none.

Not included

None.

How to merge

Rebase and merge, so that each change stays its own commit on main.

…, and keep tests off the repository .env (#61)

- Tests that spawn the PyPI country collector run it in their temporary
  directory, so it never loads the repository's .env.
- The collector refuses arguments other than --dry-run with a usage
  message and exit 2, and treats npm_config_dry_run=true (from
  `npm run collect:pypi-countries --dry-run`) as a dry run.
- When every candidate day is already fetched, --dry-run words its
  verdict as a prediction for the next new day; the next run bills nothing.
- A run that stops on a cap, a refusal or an error after landing a day
  still rewrites the 30-day rollup.
- The store's month-to-date total fails closed when any day of the month
  holds a negative or non-integer billed figure.
- The month-to-date comment says the larger figure is used because either
  source can be stale.
- The README no longer asks workflow users for Google Cloud credentials
  the scheduled workflow does not use.

Fixes #61
…country collection

The README said that any argument other than --dry-run is refused with a
usage message and exit code 2. That holds for arguments given after the
`--` separator. A flag given to `npm run` without it goes to npm and is
not among the collector's arguments, so
`npm run collect:pypi-countries --dryrun` is not refused: the collector
runs a normal collection instead of a dry run.

The README now limits the refusal to arguments after the `--` and says
what that mistyped flag does.
@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
github-analytics-tracker Ready Ready Preview Oct 7, 2026 8:20pm UTC

Request Review

@thebenignhacker
thebenignhacker merged commit 8784fac into main Oct 7, 2026
3 checks passed
@thebenignhacker
thebenignhacker deleted the integrate/2026-10-07-r7 branch October 7, 2026 20:31

This branch was successfully deployed

1 active deployment
Preview — 310a5e33 Deployed Oct 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant